#!/bin/bash

# extract symbol definition and symbol use into MySQL database
python3 run_CmgDudePass.py -p /home/plus/Downloads/bash-4.2
python3 run_CmgDudePass.py -p /home/plus/Downloads/bash-4.2/builtins
python3 run_CmgDudePass.py -p /home/plus/Downloads/bash-4.2/support
python3 run_CmgDudePass.py -p /home/plus/Downloads/bash-4.2/lib/glob
python3 run_CmgDudePass.py -p /home/plus/Downloads/bash-4.2/lib/intl
python3 run_CmgDudePass.py -p /home/plus/Downloads/bash-4.2/lib/malloc
python3 run_CmgDudePass.py -p /home/plus/Downloads/bash-4.2/lib/readline
python3 run_CmgDudePass.py -p /home/plus/Downloads/bash-4.2/lib/termcap

# fetch def-use dependency between source files into bash_def_use_dependency.rsf
python3 db_extract_def_use_dependency.py | grep depends | sed 's/\/home\/plus\/Downloads\/bash-4.2\///g' 1> bash_def_use_dependency.rsf

# extract include dependency between source files and header files into bash_include_dependency.rsf
../build/bin/cmg-ide -p /home/plus/Downloads/bash-4.2 | grep depends | sed 's/\/home\/plus\/Downloads\/bash-4.2\///g' 1>> bash_include_dependency.rsf
../build/bin/cmg-ide -p /home/plus/Downloads/bash-4.2/builtins | grep depends | sed 's/\/home\/plus\/Downloads\/bash-4.2\///g' 1>> bash_include_dependency.rsf
../build/bin/cmg-ide -p /home/plus/Downloads/bash-4.2/support | grep depends | sed 's/\/home\/plus\/Downloads\/bash-4.2\///g' 1>> bash_include_dependency.rsf
../build/bin/cmg-ide -p /home/plus/Downloads/bash-4.2/lib/glob | grep depends | sed 's/\/home\/plus\/Downloads\/bash-4.2\///g' 1>> bash_include_dependency.rsf
../build/bin/cmg-ide -p /home/plus/Downloads/bash-4.2/lib/intl | grep depends | sed 's/\/home\/plus\/Downloads\/bash-4.2\///g' 1>> bash_include_dependency.rsf
../build/bin/cmg-ide -p /home/plus/Downloads/bash-4.2/lib/malloc | grep depends | sed 's/\/home\/plus\/Downloads\/bash-4.2\///g' 1>> bash_include_dependency.rsf
../build/bin/cmg-ide -p /home/plus/Downloads/bash-4.2/lib/readline | grep depends | sed 's/\/home\/plus\/Downloads\/bash-4.2\///g' 1>> bash_include_dependency.rsf
../build/bin/cmg-ide -p /home/plus/Downloads/bash-4.2/lib/termcap | grep depends | sed 's/\/home\/plus\/Downloads\/bash-4.2\///g' 1>> bash_include_dependency.rsf